package lunsfordhall.androidapp;

import android.R;
import android.app.ListActivity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.AdapterView.*;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;

public class TestprojectActivity extends ListActivity {
    /** Called when the activity is first created. */
	
	private String[] formula_list = {"Physics Formulas", "Geometry Formulas","Algebra Formulas"};//list genres
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
       
        setListAdapter(new ArrayAdapter<String>(this, R.layout.simple_list_item_1, formula_list));
        
        getListView().setOnItemClickListener(new OnItemClickListener() {	 // gets the current list view on the app
            
			public void onItemClick(AdapterView<?> parent, View view, int position, // check when and what list item was clicked
					long id) {
				Intent showIntent = null;
				
				 if(position == 0){
					  showIntent = new Intent(getApplicationContext(),FormulaList.class);
				 }
				 
				 else if(position == 1){
					  showIntent = new Intent(getApplicationContext(),GeometryFormulas.class);
				 }
				 
				 else if(position == 2){
					  showIntent = new Intent(getApplicationContext(),AlgebraFormulas.class);
				 }
				 
				 else{
					 System.out.println("Hello");
				 }
				 
				 startActivity(showIntent);
			}		
        });
    }
}



